package com.gagakuai.transport.channel;

/*
 * @description: 消息大小评估
 * @author: houhong
 * @create: 2024-04-01 22:57
 */
public interface MessageSizeEstimator {


    Handle newHandle();


    interface  Handle{

        /*
         * Calculate the size of the given message.
         *
         * @param msg       The message for which the size should be calculated
         * @return size     The size in bytes. The returned size must be >= 0
         */
        int size(Object msg);

    }

}
